/**
 * 
 */
package com.feib.stms.dao.jdbc.rowmapper;

import java.sql.ResultSet;

import org.springframework.jdbc.core.RowMapper;

import com.feib.stms.model.Group;
import com.feib.stms.model.Securities;
import com.feib.stms.model.TempUser;
import com.feib.stms.model.User;
import java.util.Date;

/**
 * @author Lion Gao
 *
 */
public class TempUserRowMapper extends BaseRowMapper<TempUser> implements RowMapper<TempUser> 
{
	private static final long serialVersionUID = -8892893264359339120L;
	
	public TempUserRowMapper() 
	{
		super(TempUser.class);
	}

	@Override
	protected TempUser doOtherMapRow(ResultSet rs, int rowNumber, TempUser entity) 
	{	
		User user = new User();
		Group group = new Group();
		group.setGroupPk((Long)getColumnValue(rs, "GROUP_PK", Long.class));
		user.setGroup(group);
		
		Securities securities = new Securities();
		securities.setSecuritiesPk((Long)getColumnValue(rs, "SECURITIES_PK", Long.class));
		user.setSecurities(securities);
		
		user.setUserId((String)getColumnValue(rs, "USER_ID", String.class));
		user.setUserPwd((String)getColumnValue(rs, "USER_PWD", String.class));
		user.setUserName((String)getColumnValue(rs, "USER_NAME", String.class));
		user.setUserPhoneNo((String)getColumnValue(rs, "USER_PHONE_NO", String.class));
		user.setUserEmail((String)getColumnValue(rs, "USER_EMAIL", String.class));
		user.setUserNote((String)getColumnValue(rs, "USER_NOTE", String.class));
		user.setCertificateKey((String)getColumnValue(rs, "CERTIFICATE", String.class));
		user.setDealSecuritiesNos((String)getColumnValue(rs, "DEAL_SECURITIES_NOS", String.class));
		user.setLocked(getColumnBoolean(rs, "IS_LOCKED"));
		user.setEnabled(getColumnBoolean(rs, "IS_ENABLED"));
		user.setPwdExpiredDate((Date)getColumnValue(rs, "PWD_EXPIRED_DATE", Date.class));
		user.setLastLoginDate((Date)getColumnValue(rs, "LAST_LOGIN_DATE", Date.class));
		user.setPwdHistory((String)getColumnValue(rs, "PWD_HISTORY", String.class));
		user.setPwdErrorTime((Integer)getColumnValue(rs, "PWD_ERROR_TIME", Integer.class));
		user.setCaptchaErrorTime((Integer)getColumnValue(rs, "CAPTCHA_ERROR_TIME", Integer.class));
		user.setCreatedBy((String)getColumnValue(rs, "CREATED_BY", String.class));
		user.setCreatedDate((Date)getColumnValue(rs, "CREATED_DATE", Date.class));
		user.setUpdatedBy((String)getColumnValue(rs, "UPDATE_BY", String.class));
		user.setUpdatedDate((Date)getColumnValue(rs, "UPDATE_DATE", Date.class));
		
		entity.setUser(user);
		
		entity.setRecordStatus((String)getColumnValue(rs, "RECORD_STATUS", String.class));
		entity.setConfirmUserPk((Long)getColumnValue(rs, "CONFIRM_USER_PK", Long.class));
		entity.setConfirmStatus((String)getColumnValue(rs, "CONFIRM_STATUS", String.class));
		entity.setConfirmDate((Date)getColumnValue(rs, "CONFIRM_DATE", Date.class));
		return entity;
	}

}